// Copyright (c) 2007 Robin Boerdijk. All rights reserved.
//
// This software is licensed under the terms of the Microsoft Reciprocal License as described 
// in the file LICENSE.txt, which you should have received as part of this distribution. The 
// license terms are also available at http://www.opensource.org/licenses/ms-rl.html.

#include "wtkpc.h"

#include "wtk/StringEditControl.h"

namespace wtk
{
	StringEditControl::StringEditControl(DialogWindow *dialogWindow, int maxStringLength, int minDisplayLength)
		: EditControl(dialogWindow)
		, m_maxStringLength(maxStringLength)
		, m_minDisplayLength((minDisplayLength < 0) ? maxStringLength : minDisplayLength)
	{
	}

	SIZE StringEditControl::GetMinimumSize()
	{
		SIZE minimumSize = Window::GetTextBoxSize(std::wstring(m_minDisplayLength, L'W'));
		minimumSize.cx += 4;
		minimumSize.cy += 4;
		if (this->style | WS_BORDER) {
			minimumSize.cy += 2;
		}
		return minimumSize;
	}
}
